<template>
  <div class="teamWork-page">
    <div class="header">
      <div style="display: inline-block">
        <span style="margin-right: 15px">协同记录</span>
        <el-button
          size="mini"
          type="success"
          icon="el-icon-camera"
          @click="toView"
          >查看明细
        </el-button>
      </div>
      <div class="search-form">
        <el-form
          :inline="true"
          :model="searchForm"
          class="demo-form-inline"
          size="small"
        >
          <el-form-item label="">
            <el-input placeholder="请输入单据号"></el-input>
          </el-form-item>

          <el-form-item>
            <el-button
              type="success"
              plain
              @click="onSearch"
              icon="el-icon-search"
              >搜索</el-button
            >
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="body">
      <el-table
        :data="tableData"
        border
        style="width: 100%"
        header-align="center"
        height="700"
        @selection-change="handleSelectionChange"
      >
        <el-table-column fixed type="selection" align="center">
        </el-table-column>

        <el-table-column prop="FDOCUMENTSTATUS" label="状态" align="center">
        </el-table-column>
        <el-table-column prop="FBILLNO" label="单据号" align="center">
        </el-table-column>
        <el-table-column
          prop="FApplicationDate"
          label="申请日期"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="FApplicantName" label="申请人" align="center">
        </el-table-column>
        <el-table-column prop="FFULLNAME" label="部门" align="center">
        </el-table-column>
        <el-table-column prop="FCreateDate" label="创建日期" align="center">
        </el-table-column>
        <el-table-column prop="Creater" label="创建人" align="center">
        </el-table-column>
        <el-table-column prop="FAPPROVEDATE" label="审核日期" align="center">
        </el-table-column>

        <el-table-column prop="FNote" label="备注" align="center">
        </el-table-column>
        <el-table-column label="操作" width="100" align="center">
          <template v-slot="{ row }">
            <el-button type="warning" plain @click="view(row)" size="small"
              >预览</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="queryData.intPage"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="queryData.number"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { geteDrawingListApi } from "@/api/teamWork";
export default {
  data() {
    return {
      searchForm: {},
      tableData: [],
      queryData: {
        number: 10,
        intPage: 1,
        FBILLNO: "",
      },
      
      total: 0,
      selectList: [],
    };
  },
  created() {
    this.geteDrawingList();
  },
  methods: {
    async geteDrawingList() {
      const res = await geteDrawingListApi(this.queryData);
      console.log(res);
      this.total = res.data.total;
      this.tableData = res.data.rows;
    },
    onSearch() {},
    toView() {
      if (!this.selectList.length) {
        this.$message.warning("请先选择数据");
        return;
      }
      const data = this.selectList.map((ele) => {
        return ele.ID;
      });
      this.$router.push({ path: "/teamWork/teamWorkDetail", query: { data } });
    },
    handleSelectionChange(rows) {
      console.log(rows);
      this.selectList = rows;
    },
    handleSizeChange(val) {},
    handleCurrentChange(val) {},
  },
};
</script>

<style lang="scss" scoped>
.teamWork-page {
  background-color: #fff;

  .header {
    padding: 30px 20px;
    display: flex;
    justify-content: space-between;
  }

  .body {
    padding: 20px;
  }
}
</style>